import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
import Layouts from '@/layouts/Layout.vue'
import { handleRedirectNoPermission } from '@/utils/route'
import { PERMISSION_KEY } from '@/utils/constants'

const constantRoutes: Array<RouteRecordRaw> = [
  {
    path: '/',
    // name: 'main',
    component: Layouts,
    redirect: '/home', //重定向
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/Home/index.vue')
      }
      //   {
      //     // 403页面
      //     path: '/unAccessible',
      //     name: 'unAccessible',
      //     component: () => import('@/views/UnAccessible/index.vue')
      //   }
    ]
  }
  //   {
  //     // 404页面
  //     path: "/:pathMatch(.*)",
  //     name: "notFound",
  //     component: () => import("@/views/NotFound/index.vue"),
  //   },
]

const router = createRouter({
  history: createWebHistory(),
  // history: createWebHashHistory(process.env.BASE_URL),
  routes: constantRoutes
})

export default router
